<?php


// Add new post type for Portfolios
add_action('init', 'portfolios_init');
function portfolios_init() 
{
	$portfolio_labels = array(
		'name' => _x('Portfolios', 'post type general name', 'portfolios'),
		'singular_name' => _x('Portfolio', 'post type singular name', 'portfolios'),
		'all_items' => __('All Portfolios', 'portfolios'),
		'add_new' => _x('Add new portfolio', 'portfolios', 'portfolios'),
		'add_new_item' => __('Add new portfolio', 'portfolios'),
		'edit_item' => __('Edit portfolio', 'portfolios'),
		'new_item' => __('New portfolio', 'portfolios'),
		'view_item' => __('View portfolio', 'portfolios'),
		'search_items' => __('Search in portfolio', 'portfolios'),
		'not_found' =>  __('No portfolios found', 'portfolios'),
		'not_found_in_trash' => __('No portfolios found in trash', 'portfolios'), 
		'parent_item_colon' => ''
	);
	$args = array(
		'labels' => $portfolio_labels,
		'public' => true,
		'publicly_queryable' => true,
		'show_ui' => true, 
		'query_var' => true,
		'rewrite' => true,
		'capability_type' => 'post',
		'hierarchical' => false,
		'menu_position' => 20,
		'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments', 'custom-fields' ),
		'has_archive' => 'portfolios'
	); 
	register_post_type( 'portfolios', $args );
	
	add_action( 'admin_head', 'portfolios_icons' );
	function portfolios_icons()
	{
?>
	<style type="text/css" media="screen">
		#menu-posts-portfolios .wp-menu-image {
			background: url("<?php echo get_template_directory_uri(); ?>/includes/portfolios_small.png") no-repeat 6px !important;
		}
		
		#menu-posts-portfolios:hover .wp-menu-image,
		#menu-posts-portfolios.wp-menu-open .wp-menu-image{
			background: url("<?php echo get_template_directory_uri(); ?>/includes/portfolios_small_hover.png") no-repeat 6px !important;
		}
		
		.icon32-posts-portfolios {
			background: url("<?php echo get_template_directory_uri(); ?>/includes/portfolios.png") no-repeat !important;
		}
		
		/* NEEDS BE DONE */
		#adminmenu .menu-icon-dashboard div.wp-menu-image {
			background:transparent url('../images/menu.png?ver=20100531') no-repeat scroll -60px -33px;\
		}
		
		#adminmenu .menu-icon-dashboard:hover div.wp-menu-image,
		#adminmenu .menu-icon-dashboard.wp-has-current-submenu div.wp-menu-image,
		#adminmenu .menu-icon-dashboard.current div.wp-menu-image {
			background:transparent url('../images/menu.png?ver=20100531') no-repeat scroll -60px -1px;
		}

    </style>
    <?php
	} // END function portfolios_icons()
	

} // END function portfolios_init() 

add_action( 'init', 'portfolios_create_taxonomies', 0 );
function portfolios_create_taxonomies() 
{
	$categories_labels = array(
		'name' => _x( 'Categories', 'taxonomy general name', 'portfolios' ),
		'singular_name' => _x( 'Portfolio Category', 'taxonomy singular name', 'portfolios' ),
		'search_items' =>  __( 'Search in portfolio categories', 'portfolios' ),
		'all_items' => __( 'All portfolio categories', 'portfolios' ),
		'most_used_items' => null,
		'parent_item' => null,
		'parent_item_colon' => null,
		'edit_item' => __( 'Edit portfolio category', 'portfolios' ), 
		'update_item' => __( 'Update portfolio category', 'portfolios' ),
		'add_new_item' => __( 'Add new portfolio category', 'portfolios' ),
		'new_item_name' => __( 'New portfolio category', 'portfolios' ),
		'menu_name' => __( 'Categories', 'portfolios' )
	);	
	
	register_taxonomy('portfolio_category','portfolios',array(
		'hierarchical' => true,
		'labels' => $categories_labels,
		'show_ui' => true,
		'query_var' => true,
		'rewrite' => array('slug' => 'category' )
	));
} // END function portfolios_create_taxonomies() 


?>